window.onload = function () {

    const oUsername = document.querySelector('input');
    const oEnterBtn = document.querySelector('button');

    const init = () => {
        bindEvent()
    }

    function bindEvent () {
        oEnterBtn.addEventListener('click',handleBtn,false)
    }

    function handleBtn(){
        const username = oUsername.value.trim()

        if(username.length < 1){
            alert('少于1位数')
            return
        }

        localStorage.setItem('username',username)
        location.href = 'index.html'
    }

    init()

}


